import React from 'react';
import { Link } from 'react-router-dom';
import { Table, Space } from 'antd';
import { useApi } from '@/hooks/useApi';
import { fetchList } from '@/api/apiData';
const { Column } = Table;
const ApiDataList: React.FC = () => {
    const [data, setData] = useApi(fetchList, 0);
    // 获取所有表
    return (
        <div>
            <Table dataSource={data} rowKey="_id">
                <Column title="接口名称" key="apiName" dataIndex='apiName' />
                <Column title="接口地址" key="apiPath" dataIndex='apiPath' />
                <Column title="接口请求方式" key="apiType" dataIndex='apiType' />
                <Column title="所属分类" key="categoryName" dataIndex='categoryName' />
                <Column title="描述" key="desc" dataIndex='desc' />
                <Column title="创建时间" key="createTime" dataIndex='createTime' />
                <Column title="操作" key="action"
                    render={(text, record) => (
                        <Space size="middle">
                            <Link to={'/home/data/management?id=' + text._id} >数据管理</Link>
                        </Space>
                    )}
                />
            </Table>
        </div>
    )
}

export default ApiDataList; 
